package com.java.tutorials.jdk7.bitset;

import java.util.BitSet;

/**
 * Created by xuzhike on 2016/1/21.
 * http://www.java2s.com/Code/Java/JDK-7/UsingthenewBitSetmethodsinJava17.htm
 * Using the new BitSet methods in Java 1.7
 */
public class BitSetTest {
    public static void main(String[] args) {
        BitSet bitSet = new BitSet();
        long[] array = { 1, 2, 3 };
        bitSet = BitSet.valueOf(array);
        System.out.println(bitSet);

        long[] tmp = bitSet.toLongArray();
        for (long number : tmp) {
            System.out.println(number);
        }

        System.out.println(bitSet.previousSetBit(1));
        System.out.println(bitSet.previousClearBit(66));

    }
}
